<?php

namespace App\Http\Controllers\home;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;

/**
* 添加问题
* 
* @return array
*/
class IssueController extends Controller
{
    //添加问题
    public function postInsert(Request $request)
    {	
      //获取提交的数据
    	 $data = $request->except(['_token','topic']);
       // dd($data);
       //插入数据库
      $res = DB::table('issue')->insert($data);

      //返回主页
      return redirect('home/tzsy/');

    }

  /**
   * Ajax查询话题 
   *
   * @return data
   */
  public function getSousuo(Request $request)
  {
    $topic = $request->input('topic');

    
    $data = DB::table('topic')
      ->where('title','like','%'.$topic.'%')
      ->get();
      return $data;

  }

  //seach  搜索
  public function getSeach(Request $request)
  {
    
    //查询数据库获取信息
     $topic = $request->input('mass');
    
    $data = DB::table('topic')
      ->where('title','like','%'.$topic.'%')
      ->get();
      return $data;

  }
    

}